fix(temporal): retry Glitter startup metric restoration - #2006
fix(temporal): retry Glitter startup metric restoration#2006shepherdjerred wants to merge 1 commit into
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
PR Summary by QodoRetry Glitter startup snapshot-metric restoration on transient storage failures
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1a2694e6f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return ( | ||
| error instanceof Error && | ||
| TRANSIENT_STORAGE_ERROR_PATTERN.test(`${error.name} ${error.message}`) | ||
| ); |
There was a problem hiding this comment.
Read the structured transport error code
When SeaweedFS resets a connection, the Node/Bun HTTP stack can surface an error such as Object.assign(new Error("socket hang up"), { code: "ECONNRESET" }); the code is not guaranteed to appear in name or message. This predicate therefore returns false for a transient failure it explicitly intends to handle, causing the startup supervisor to stop after the first failed restoration and leaving the snapshot metric absent until the worker restarts. Parse and inspect the structured code field (and, where applicable, the transport cause) rather than testing only rendered error text.
Useful? React with 👍 / 👎.
Code Review by Qodo
1. Cause chain not retried
|
| return ( | ||
| error instanceof Error && | ||
| TRANSIENT_STORAGE_ERROR_PATTERN.test(`${error.name} ${error.message}`) | ||
| ); |
There was a problem hiding this comment.
1. Cause chain not retried 🐞 Bug ☼ Reliability
isTransientCorpusStorageError only checks the top-level error’s $metadata.httpStatusCode and a regex
against ${error.name} ${error.message}, so a transient connection failure that is wrapped in an
Error.cause chain (where the outer error message doesn’t include the connection code) will be
treated as non-transient and will stop the startup retry loop.
Agent Prompt
## Issue description
`isTransientCorpusStorageError` ignores `Error.cause` and only inspects the outer error’s `name/message` for connection codes. If an SDK/network layer wraps the underlying connection error (common pattern in this repo), the transient signal may live in `cause` and retries won’t happen.
## Issue Context
There is already repo precedent for walking `.cause` chains to find the real failure message.
## Fix Focus Areas
- packages/temporal/src/activities/glitter-corpus-store.ts[23-41]
- packages/temporal/src/activities/data-dragon-util.ts[217-226]
## Suggested fix
- Build a helper to iterate `error` and its `.cause` chain (with cycle protection / depth limit), and for each link:
- check `$metadata.httpStatusCode` (408/429/5xx)
- check connection code patterns against combined text (e.g., `${name} ${message} ${stack ?? ""}`)
- optionally check a common `code` field (e.g., `(err as any).code`) if present.
- Return true if any link matches transient criteria.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| if (result === "succeeded") { | ||
| jsonLog("info", "Glitter corpus snapshot metric restoration completed"); | ||
| } |
There was a problem hiding this comment.
2. Misleading completion log 🐞 Bug ◔ Observability
worker.ts logs “Glitter corpus snapshot metric restoration completed” whenever retryUntilReady returns "succeeded", but restoreGlitterCorpusSnapshotMetrics can return early without restoring anything (not configured or latest pointer missing), making the log message inaccurate.
Agent Prompt
## Issue description
The worker logs a completion message on any successful return from `restoreGlitterCorpusSnapshotMetrics`, but that function can legitimately do no work (e.g., metrics not configured or pointer missing). This makes logs less trustworthy during incident response.
## Issue Context
`restoreGlitterCorpusSnapshotMetrics` returns `void` and uses early returns for “skip” cases.
## Fix Focus Areas
- packages/temporal/src/worker.ts[91-119]
- packages/temporal/src/activities/glitter-corpus-snapshot.ts[41-59]
## Suggested fix
- Change `restoreGlitterCorpusSnapshotMetrics` to return a small status enum, e.g. `"restored" | "not_configured" | "pointer_missing"`.
- In `worker.ts`, log different messages (or include a field like `{ outcome }`) and only say “completed”/“restored” when metrics were actually updated.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Summary
Verification
The Prometheus alert expression, schedule timing, and PagerDuty routing are unchanged.